﻿using Hotel.DAL;
using Hotel.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotel.BLL
{
    public class ShopBLL
    {
        public ShopBLL(ShopDAL shopDAL) 
        {
            ShopDAL = shopDAL;
        }

        public ShopDAL ShopDAL { get; }


        /// <summary>
        /// 添加门店
        /// </summary>
        /// <param name="shopModel"></param>
        /// <returns></returns>
        public int ShopAdd(ShopModel shopModel)
        {
            int res = ShopDAL.SearchShopName(shopModel.ShopName);
            if (res> 0) 
            {
                return -1;//重复
            
            }
            else
            {
                int r = ShopDAL.ShopAdd(shopModel);
                if (r> 0) 
                {
                return 1;//成功
                
                }
                else
                {
                    return -2;
                }
            }


        }




        


























    }
}
